import { axios } from '@/utils/request'

/**
 * 保存
 * @params data
 * {
    {"allowDelete":{"description":"是否允许删除 ","type":"integer"}},
    {"attributeName":{"description":"属性名称","type":"string"}},
    {"attributeTag":{"description":"属性标识","type":"string"}},
    {"attributeType":{"description":"属性类型","type":"string"}},
    {"beNull":{"description":"是否为空，0：可为空  1：不为空","type":"integer"}},
    {"beUnique":{"description":"是否唯一，0：不唯一 1：唯一","type":"integer"}},
    {"createBy":{"description":"创建人","type":"string"}},
    {"createDate":{"description":"创建时间","type":"string"}},
    {"modifyBy":{"description":"修改人","type":"string"}},
    {"modifyDate":{"description":"修改时间","type":"string"}},
    {"serialNum":{"description":"排序","type":"integer"}},
    {"tableName":{"description":"表名","type":"string"}}
   }
 */
export function postUdaModelExtension (data) {
  return axios({
    method: 'post',
    url: 'uda/model-extension',
    data
  })
}

/**
 * 修改
 * @params data
 * {
    {"allowDelete":{"description":"是否允许删除 ","type":"integer"}},
    {"attributeName":{"description":"属性名称","type":"string"}},
    {"attributeTag":{"description":"属性标识","type":"string"}},
    {"attributeType":{"description":"属性类型","type":"string"}},
    {"beNull":{"description":"是否为空，0：可为空  1：不为空","type":"integer"}},
    {"beUnique":{"description":"是否唯一，0：不唯一 1：唯一","type":"integer"}},
    {"createBy":{"description":"创建人","type":"string"}},
    {"createDate":{"description":"创建时间","type":"string"}},
    {"id":{"description":"$column.comments","type":"integer"}},
    {"modifyBy":{"description":"修改人","type":"string"}},
    {"modifyDate":{"description":"修改时间","type":"string"}},
    {"serialNum":{"description":"排序","type":"integer"}},
    {"tableName":{"description":"表名","type":"string"}}
   }
 */
export function putUdaModelExtension (data) {
  return axios({
    method: 'put',
    url: 'uda/model-extension',
    data
  })
}

/**
 * 删除
 * @params params
 * {
    {"id":{"required":true,"type":"integer"}}
   }
 */
export function deleteUdaModelExtension (params) {
  return axios({
    method: 'delete',
    url: 'uda/model-extension',
    params
  })
}

/**
 * 详情
 * @params params
 * {
    {"id":{"required":true,"type":"integer"}}
   }
 */
export function getUdaModelExtensionInfo (params) {
  return axios({
    method: 'get',
    url: 'uda/model-extension/info',
    params
  })
}

/**
 * 列表
 * @params params
 * {
    {"tableName":{"required":true,"type":"string"}}
   }
 */
export function getUdaModelExtensionList (params) {
  return axios({
    method: 'get',
    url: 'uda/model-extension/list',
    params
  })
}

/**
 * 下移动拓展字段排列顺序
 * @params data
 *
 */
export function putUdaModelExtensionMoveDown (data) {
  return axios({
    method: 'put',
    url: 'uda/model-extension/move-down',
    data
  })
}

/**
 * 上移动拓展字段排列顺序
 * @params data
 *
 */
export function putUdaModelExtensionMoveUp (data) {
  return axios({
    method: 'put',
    url: 'uda/model-extension/move-up',
    data
  })
}

/**
 * 分页列表
 * @params params
 * {
    {"pageNo":{"required":false,"type":"integer","default":1}},
    {"tableName":{"required":false,"type":"string"}},
    {"pageSize":{"required":false,"type":"integer","default":20}}
   }
 */
export function getUdaModelExtensionPageList (params) {
  return axios({
    method: 'get',
    url: 'uda/model-extension/page/list',
    params
  })
}

/**
 * 验证唯一性
 * @params params
 * {
    {"id":{"required":false,"type":"integer"}},
    {"tableName":{"required":true,"type":"string"}},
    {"field":{"required":true,"type":"string"}},
    {"value":{"required":true,"type":"string"}}
   }
 */
export function getUdaModelExtensionUnique (params) {
  return axios({
    method: 'get',
    url: 'uda/model-extension/unique',
    params
  })
}
